package com.example.lotterysystem.service.mq;

import com.example.lotterysystem.common.utils.JacksonUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.util.Map;

import static com.example.lotterysystem.common.config.DirectRabbitConfig.*;

@Slf4j
@Component
@RabbitListener(queues = DLX_QUEUE_NAME)
public class DlxReceiver {
    @Autowired
    private RabbitTemplate rabbitTemplate;


@RabbitHandler
    public void process(Map<String, String> message) {
        //死信队列处理
        log.info("开始处理异常消息! messageId={}, body={}", message.get("messageId"), message);
        // 为避免无限重发，这里不再回投原交换机，改为仅记录或后续落库人工处理
        // 如需再次回投，请务必增加次数控制或转ParkingLot队列
    }
}
